package com.xzh.api;

import com.xzh.service.StatisticsService;
import com.xzh.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/statistics")
public class StatisticsApi {
    private StatisticsService statisticsService;
    @Autowired
    public void setStatisticsService(StatisticsService statisticsService) {
        this.statisticsService = statisticsService;
    }

    @GetMapping("cards")
    public ResponseEntity<JsonResult<?>> cards(){
        Map<String,Object> stats = statisticsService.counts();
        return ResponseEntity.ok(JsonResult.success(stats));
    }
}
